local boshe = fk.CreateSkill{
  name = "xiaobai__boshe",
}

Fk:loadTranslationTable{
  ["xiaobai__boshe"] = "博涉",
  [":xiaobai__boshe"] = "一名角色的回合结束时，若当前回合角色本回合恰好以四种不同的方式失去过牌，你可以摸一张牌并与其各获得一张【影】。"
}

local U = require "packages.utility.utility"

boshe:addEffect(fk.TurnEnd, {
  can_trigger = function (self, event, target, player, data)
    if not player:hasSkill(self) then return false end
    local way_lost = {}
    player.room.logic:getEventsOfScope(GameEvent.MoveCards, 1, function (e)
      for _, move in ipairs(e.data) do
        if move.from == target then
          table.insertIfNeed(way_lost,move.moveReason)
        end
      end
    end,Player.HistoryTurn)
    if #way_lost >= 4 then
      return true
    end
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    room:drawCards(player, 1, boshe.name)
    if player.dead then return end
    room:moveCardTo(U.getShade(room, 1), Card.PlayerHand, player, fk.ReasonJustMove, boshe.name, nil, true, player)
    if player.dead then return end
    room:moveCardTo(U.getShade(room, 1), Card.PlayerHand, target, fk.ReasonJustMove, boshe.name, nil, true, player)
  end
})

return boshe